﻿--Truy van 01
USE [BenhVien_Team_30_Index]
GO
create nonclustered index i1 on BenhNhan (HoTen)
drop index BenhNhan.i1
SELECT MABN, CMND,DienThoai, HoTen, NgaySinh, DiaChi, GioiTinh
FROM BENHNHAN WHERE CMND = 'S5DBDN1W3N95M7SGZ0THQYQ5HDUL'
--Truy van 02:
USE [BenhVien_Team_30_Index]
GO

DECLARE	@return_value int

EXEC	@return_value = [dbo].[sp_ThemMoiHoSoBenhNhan]
		@CMND = NULL,
		@DienThoai = NULL,
		@HoTen = NULL,
		@NgaySinh = NULL,
		@DiaChi = NULL,
		@GioiTinh = NULL,
		@SoThe = NULL,
		@NgayHetHang = NULL,
		@TinhTrang = NULL

SELECT	'Return Value' = @return_value

GO

--Truy van 03
-------Setup index-------
USE [BenhVien_Team_30_Index]
GO
CREATE NONCLUSTERED INDEX i2
ON [dbo].[BenhNhan] ([CMND],[HoTen])

USE [BenhVien_Team_30_Index]
GO
CREATE NONCLUSTERED INDEX i3
ON [dbo].[BenhAn] ([MaBN])
INCLUDE ([MaBA])

USE [BenhVien_Team_30_Index]
GO

DECLARE	@return_value int

EXEC	@return_value = [dbo].[sp_ThemMoiHoSoBenhAn]
		@XetNghiem = NULL,
		@ChuanDoan = NULL,
		@ChiDinh = NULL,
		@MaBN = NULL,
		@HoTen = NULL,
		@CMND = NULL,
		@TinhTrangBenh = NULL,
		@SoPhong = NULL,
		@NgayKham = NULL

SELECT	'Return Value' = @return_value
GO
--Truy van 04:
USE [BenhVien_Team_30_Index]
GO

DECLARE	@return_value int

EXEC	@return_value = [dbo].[sp_TieuSuBenh]
		@MaHS = 1

SELECT	'Return Value' = @return_value

GO
--Truy van 05:
USE [BenhVien_Team_30_Index]
GO

DECLARE	@return_value int

EXEC	@return_value = [dbo].[sp_ThemMoiHoSoNhapVien]
		@CMND = NULL,
		@DienThoai = NULL,
		@HoTen = NULL,
		@NgaySinh = NULL,
		@DiaChi = NULL,
		@GioiTinh = NULL,
		@SoPhong = NULL,
		@MaBS = NULL,
		@SoThe = NULL,
		@NgayHetHang = NULL,
		@XetNghiem = NULL,
		@ChuanDoan = NULL,
		@ChiDinh = NULL,
		@TinhTrangBenh = NULL,
		@TinhTrang = NULL

SELECT	'Return Value' = @return_value

GO
USE [BenhVien_Team_30_Index]
GO
CREATE NONCLUSTERED INDEX i4
ON [dbo].[HoSoNhapVien] ([MaBA])